﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Npu_Platform
{
    class MessageManage
    {
        delegate void SetTextCallback(String Text);
        delegate void MessageBoxCallback(Exception Ex);
        public void ShowError(Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
        public void DisplayError(Exception ex)
        {
            MessageBoxCallback d = new MessageBoxCallback(ShowError);
            this.Invoke(d, new object[] { ex });
        }
        public void DisplayMessage(String s)
        {
            SetTextCallback d = new SetTextCallback(ShowMessage);
            this.Invoke(d, new object[] { s });
        }
        public void ShowMessage(String s,object display)
        {
            display.Text += s + "\r\n";
        }
    }
}
